package ren.kane.asdppp.transaction.change;

import ren.kane.asdppp.PayrollDatabase;
import ren.kane.asdppp.Employee;
import ren.kane.asdppp.transaction.Transaction;

/**
 * @author renrk(1275) on 2019-04-20 8:57 PM
 **/
public abstract class ChangeEmployeeTransaction implements Transaction {

    private int empId;

    public ChangeEmployeeTransaction() {
    }

    public ChangeEmployeeTransaction(int empId) {
        this.empId = empId;
    }

    @Override
    public void execute() {
        Employee employee = PayrollDatabase.getEmployee(empId);
        if (null != employee) {
            change(employee);
        }
    }

    protected abstract void change(Employee employee);
}
